package com.yksj.healthtalk.entity;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class ServerSeachEntity implements Serializable{
	private String  MERCHANT_ID;
	private String  CLASS_ID;
	private String  CLASS_NAME;
	private String  UPPER_CLASS_ID;
	private String  NOTES;
	private String  CLASS_TYPE;
	private String  CLASS_STATE;
	private String  STATE_TIME;
	private JSONArray  SUBLIST;
	
	public String getMERCHANT_ID() {
		return MERCHANT_ID;
	}
	public void setMERCHANT_ID(String mERCHANT_ID) {
		MERCHANT_ID = mERCHANT_ID;
	}
	public String getCLASS_ID() {
		return CLASS_ID;
	}
	public void setCLASS_ID(String cLASS_ID) {
		CLASS_ID = cLASS_ID;
	}
	public String getCLASS_NAME() {
		return CLASS_NAME;
	}
	public void setCLASS_NAME(String cLASS_NAME) {
		CLASS_NAME = cLASS_NAME;
	}
	public String getUPPER_CLASS_ID() {
		return UPPER_CLASS_ID;
	}
	public void setUPPER_CLASS_ID(String uPPER_CLASS_ID) {
		UPPER_CLASS_ID = uPPER_CLASS_ID;
	}
	public String getNOTES() {
		return NOTES;
	}
	public void setNOTES(String nOTES) {
		NOTES = nOTES;
	}
	public String getCLASS_TYPE() {
		return CLASS_TYPE;
	}
	public void setCLASS_TYPE(String cLASS_TYPE) {
		CLASS_TYPE = cLASS_TYPE;
	}
	public String getCLASS_STATE() {
		return CLASS_STATE;
	}
	public void setCLASS_STATE(String cLASS_STATE) {
		CLASS_STATE = cLASS_STATE;
	}
	public String getSTATE_TIME() {
		return STATE_TIME;
	}
	public void setSTATE_TIME(String sTATE_TIME) {
		STATE_TIME = sTATE_TIME;
	}
	public JSONArray getSUBLIST() {
		return SUBLIST;
	}
	public void setSUBLIST(JSONArray sUBLIST) {
		SUBLIST = sUBLIST;
	}
	
	
	public	static List<ServerSeachEntity>  parseToEntity(String json){
		JSONArray array;
		List<ServerSeachEntity> entities;
		try {
			array=new JSONArray(json);
			entities = new ArrayList<ServerSeachEntity>();
			for (int i = 0; i < array.length(); i++) {
				ServerSeachEntity entity=new ServerSeachEntity();
				JSONObject object=(JSONObject) array.get(i);
				entity.setCLASS_ID(object.getString("CLASS_ID"));
				entity.setCLASS_NAME(object.getString("CLASS_NAME"));
				entity.setCLASS_STATE(object.getString("CLASS_STATE"));
				entity.setCLASS_TYPE(object.getString("CLASS_TYPE"));
				entity.setMERCHANT_ID(object.getString("MERCHANT_ID"));
				entity.setNOTES(object.getString("NOTES"));
				entity.setSTATE_TIME(object.getString("STATE_TIME"));
				entity.setSUBLIST(object.getJSONArray("SUBLIST"));
				entity.setUPPER_CLASS_ID(object.getString("UPPER_CLASS_ID"));
				entities.add(entity);
			}
		} catch (JSONException e) {
			return null;
		}
		
		return entities;
	}
	
	
	
}
